<template>
  <div id="userinfo">
    <Row class="restand">
      <i-col class="standkepudigndan" span="17">
        <div class="standardt">
          用户所有订单
        </div>
        <div class="result">
          <Row class="orderrow" v-for="(item,index) in results" :key="index">
            <i-col span="2">
              <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
              <div @click="getOrderDetail(item.id)" class="itemtitle">{{ item.orderSn }}</div>
              <div class="itemics">总金额:<span class="itemicss">{{ item.totalAmount }}</span><span class="itemicss">总页数:</span><span class="itemcsss">{{ item.standardPages }}</span></div>
            </i-col>
            <i-col span="2"><span @click="getOrderDetail(item.id)" class="itemdetail">查看详情</span></i-col>
          </Row>
          <Page :total="dataCount" :page-size="pageSize" show-total @on-change="changepage" v-if="showPage" class-name="changepage" show-elevator />
        </div>
      </i-col>
    </Row>
  </div>
</template>

<script>
import {neturl} from '../assets/js/common'
export default {
  name: 'seniorsearch',
  data () {
    return {
      msg: '内蒙古标准文献服务平台',
      theme1: 'light',
      byname: 'bymenu',
      value: '',
      results: [],
      model1: '',
      keyword: '',
      dataCount: 0,
      pageSize: 10,
      pageNum: 1,
      showPage: false,
      userinfo: '',
      islogin: false,
      islog: true,
      username: '',
      tatolDeposit: '',
      tatolPoint: ''
    }
  },
  methods: {
    getSearchResult () {
      let uploadcc = { data: '{page: ' + this.pageNum + ', pagesize: ' + this.pageSize + ', memid:"' + this.userinfo.userId + '"}' }
      this.$axios.post(neturl + '/by/order/getByUserId?token=' + this.userinfo.token + '&loginMark=' + this.userinfo.loginMark, uploadcc
      ).then(res => {
        // console.log(res)
        this.results = res.data.data.result
        this.dataCount = res.data.data.records
        this.showPage = true
        this.$Spin.hide()
      })
    },
    changepage (value) {
      this.pageNum = value
      this.getSearchResult()
    },
    getOrderDetail (id) {
      // console.log(id)
      let routeData = this.$router.resolve({path: '/orderdetail', query: {id: id}})
      window.open(routeData.href, '_blank')
    }
  },
  created () {
    this.$Spin.show()
    // this.model1 = this.cityList[0].value
    this.userinfo = this.$cookie.get('user')
    if (this.userinfo === null) {
      this.$router.push('/login')
    }
    this.userinfo = JSON.parse(this.userinfo)
    // 已登录
    if (this.userinfo != null) {
      this.islogin = true
      this.islog = false
      this.username = this.userinfo.realName
    }
    this.getSearchResult()
  }
}
</script>
<style scoped>
  @import '../assets/css/userorders.css';
</style>
